﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Media.Imaging;

namespace Scalextric
{
    public class Track
    {
        private string _Name = String.Empty;
        private double _Length = 0;
        private BitmapImage _Image = null;
        private Lap _LapRecord = null;

        public string Name { get { return _Name; } set { _Name = value; } }
        public double Length { get { return _Length; } set { _Length = value; } }
        public BitmapImage Image { get { return _Image; } set { _Image = value; } }
        public Lap LapRecord { get { return _LapRecord; } set { _LapRecord = value; } } //get driver through lap / car /driver
    }

    public class Driver
    {
        private string _Name = String.Empty;
        private Color _Colour = Color.Transparent;
        private BitmapImage _Image = null;

        public string Name { get { return _Name; } set { _Name = value; } }
        public BitmapImage Image { get { return _Image; } set { _Image = value; } }
        public Color Colour { get { return _Colour; } set { _Colour = value; } }
    }

    public class Car
    {
        private string _Name = String.Empty;
        private BitmapImage _Image = null;
        private Driver _Driver = new Driver();
        private Controller _Controller = new Controller();

        public string Name { get { return _Name; } set { _Name = value; } }
        public BitmapImage Image { get { return _Image; } set { _Image = value; } }
        public Driver Driver { get { return _Driver; } set { _Driver = value; } }
        public Controller Controller { get { return _Controller; } set { _Controller = value; } }
    }

    public class Controller
    {
        private string _Name = String.Empty;
        private Color _Colour = Color.Transparent;
        private string _Controller = String.Empty;

        public string Name { get { return _Name; } set { _Name = value; } }
        public string ControllerID { get { return _Controller; } set { _Controller = value; } }
        public Color Colour { get { return _Colour; } set { _Colour = value; } }
    }

    public class Lap
    {
        private Car _Car = new Car();
        private Track _Track = new Track();
        private TimeSpan _Time = new TimeSpan();
        private int _LapNumber = 0;
        private double _Speed = 0;

        public Car Car { get { return _Car; } set { _Car = value; } }
        public Track Track { get { return _Track; } set { _Track = value; } }
        public TimeSpan Time { get { return _Time; } set { _Time = value; } }
        public int LapNumber { get { return _LapNumber; } set { _LapNumber = value; } }
        public double Speed { get { if (_Time != null && _Track.Length > 0) { return (_Track.Length / (_Time.Milliseconds / 1000)); } else { return 0; }; } set { } } // use track length and timespan to work out - always sec and meters
    }

    public class FreePractice
    {
        //has all stuff to run fp
        private TimeSpan _Length = new TimeSpan();

        public TimeSpan Length { get { return _Length; } set { _Length = value; } }
    }

    public class Qualifying
    {
        //has all stuff to run fp
        public TimeSpan Length { get; set; }
        public int Laps { get; set; }
        public QualResult Result { get; set; }
    }

    public class RaceEvent
    {
        private List<Car> _Cars = new List<Car>();
        private FreePractice _FreePractise= new FreePractice();
        private Qualifying _Qualifying = new Qualifying();
        private Race _Race = new Race();

        public List<Car> Cars { get { return _Cars; } set { _Cars = value; } }
        public FreePractice FreePractise { get { return _FreePractise; } set { _FreePractise = value; } }
        public Qualifying Qualifying { get { return _Qualifying; } set { _Qualifying = value; } }
        public Race Race { get { return _Race; } set { _Race = value; } }
    }

    public class Race
    {
        //race class 
    }

    public class QualResult
    {

    }
}
